<template>
  <div>
    <HeaderViewVue />
    <!-- 折叠面板 -->
    <h2>最新公告📌</h2>
    <el-collapse accordion>
      <el-collapse-item v-for="item in noticeList" :key="item.nid" :title="item.title">
        <div>{{ item.content }}</div>
        <div>时间：{{ $toDate(item.create_time) }}</div>
      </el-collapse-item>
    </el-collapse>
    <FooterViewVue />
  </div>
</template>

<script>
import HeaderViewVue from './HeaderView.vue'
import FooterViewVue from './FooterView.vue'
import { getNoticeList } from '@/api/notice'
export default {
  name: 'NoticeView',
  components: { HeaderViewVue, FooterViewVue },
  data() {
    return {
      noticeList: [],
    }
  },
  created() {
    getNoticeList().then((result) => (this.noticeList = result.data))
  },
}
</script>

<style lang="less" scoped>
h2 {
  margin-top: 50px;
  color: #f56c6c;
  text-align: center;
}
.el-collapse {
  width: 700px;
  margin: 0 auto;
}
</style>
